package com.ym.config;

import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.sleuth.autoconfig.brave.SamplerProperties;
import org.springframework.cloud.sleuth.zipkin2.ZipkinProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
//public class TraceAutoConfig {
//
//    @Bean
//    @ConditionalOnMissingBean(ZipkinProperties.class)
//    @ConfigurationProperties(prefix = "spring.zipkin")
//    public ZipkinProperties zipkinProperties() {
//        ZipkinProperties properties = new ZipkinProperties();
//        // 设置 base-url 默认值
//        if (StringUtils.isEmpty(properties.getBaseUrl())) {
//            properties.setBaseUrl("http://100.122.222.104:9411");
//        }
//        return properties;
//    }
//
//    @Bean
//    @ConditionalOnMissingBean(SamplerProperties.class)
//    @ConfigurationProperties(prefix = "spring.sleuth.sampler")
//    public SamplerProperties samplerProperties() {
//        SamplerProperties properties = new SamplerProperties();
//        // 设置采样率
//        if (properties.getProbability() == null) {
//            properties.setProbability(0.1f);
//        }
//        return properties;
//    }
//}
